<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>补零</title>
</head>
<body>
    当用户输入为个位数时，点击补零按钮补零为十位数
    <input type="text" id="numberInput" placeholder="输入个位数">
    <button onclick="addZero()">补零</button>
</body>
</html>

<script>
    function addZero() {
        let input = document.getElementById('numberInput');
        let value = input.value;
        if (value.length === 1) {
            input.value = '0' + value;

            alert('0'+ value);
        }
    }
</script>
